package com.action.ui.adapter;

import android.view.View;
import android.widget.TextView;

import com.base.app_core.model.dto.SelectDisRangeDto;
import com.base.app_core.View.xrecyclerview.RecyclerAdapter;
import com.base.app_core.View.xrecyclerview.RecyclerViewHolder;
import com.xinglai.yun.R;

import butterknife.BindView;

/**
 * Created by jiansheng.li on 2017/10/11.
 */

public class ShowLocatioHisAdapter extends RecyclerAdapter<SelectDisRangeDto, ShowLocatioHisAdapter.ViewHolder> {

    private onHistorySeleted circleHandlerInterface;

    @Override
    protected void fillData(final SelectDisRangeDto item, final ViewHolder holder) {
        holder.rangeTv.setSelected(item.isSeleted());
        holder.rangeTv.setText(item.getRangeStr());
        holder.rangeTv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                circleHandlerInterface.onSeleted(item);
            }
        });
    }

    @Override
    protected int getItemLayoutId() {
        return R.layout.item_his_layout;
    }

    public class ViewHolder extends RecyclerViewHolder {

        @BindView(R.id.img_content)
        TextView rangeTv;

        public ViewHolder(View itemView) {
            super(itemView);
        }
    }

    public void setHisHandlerInterface(onHistorySeleted circleHandlerInterface) {
        this.circleHandlerInterface = circleHandlerInterface;
    }

    public interface onHistorySeleted {

        void onSeleted(SelectDisRangeDto item);
    }
}
